<template>
  <div>
    <!-- 搜索 -->
    <div class="section1">
      <div class="section1-1">
        <i class="el-icon-search" @click="sousuo"></i>
        <input
          type="text"
          placeholder="请输入内容"
          v-model="filterText"
          class="input1"
        />
      </div>
    </div>
       <!-- 状态查询 -->
    <div class="section2">
      <div class="section2-1">
       <el-select
            v-model="value"
            placeholder="状态"
            @change="changeClick"
          >
            <el-option
              v-for="item in options"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            ></el-option>
          </el-select>
          </div>
    </div>
    <!-- 表格数据 -->
    <div>
      <el-table :data="tableData" style="width: 100%">
        <el-table-column prop="withdrawDeposit_id" label="提现id"></el-table-column>
        <el-table-column prop="user.user_name" label="用户名"></el-table-column>
        <el-table-column
          prop="withdrawDeposit_getmoney"
          label="提现金额"
          width="80"
        ></el-table-column>
        <el-table-column
          prop="withdrawDeposit_application_time"
          label="申请时间"
        ></el-table-column>
        <el-table-column
          prop="withdrawDeposit_review_time"
          label="审核时间"
        ></el-table-column>
        <el-table-column prop="withdrawDeposit_getmoney_state" label="审核状态" ref="shenke">
          <!-- <template slot-scope="scope">
         <span v-text="scope.row.order_state === 0 ? '待审核':'提现完成'"></span>
         <span v-text="scope.row.order_state === 1 ? '提现失败':'提现完成'"></span>
         </template> -->
        </el-table-column>
        <el-table-column prop="admin.admin_name" label="审核人"></el-table-column>
          <el-table-column label="操作" width="60">
          <template slot-scope="scope">
            <el-dropdown>
              <span class="el-dropdown-link">
                <i class="el-icon-arrow-down el-icon--right"></i>
              </span>
              <el-dropdown-menu slot="dropdown">
                <el-dropdown-item @click.native="modify(scope.row, 0)"
                  >同意</el-dropdown-item
                >
                <el-dropdown-item @click.native="modify(scope.row, 0)"
                  >拒绝</el-dropdown-item
                >
              </el-dropdown-menu>
            </el-dropdown>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <!-- 分页 -->
    <div class="paging">
      <el-pagination
        @current-change="handleCurrentChange"
        :current-page.sync="currentPage"
        :page-size="pageNum"
        layout="prev, pager, next, jumper"
        :total="drugList"
      ></el-pagination>
    </div>
  </div>
</template>
<script>
import http from '../api';
export default {
  data() {
    return {
      filterText: '',
      tableData: [],
      currentPage: 1,
      pageNum: 6,
      drugList: 0,
      shenke:0,
       options: [{
          value: 2,
          label: '全部'
        },{
          value: 0,
          label: '待审核'
        }, {
          value: 1,
          label: '提现失败'
        },{
          value: 3,
          label: '提现完成'
        },],
        value: ''
    };
  },
  computed: {
 
  },
  mounted() {
    let nowPage = parseInt(this.currentPage);
    console.log(this.currentPage);
    this.getData('');
  },
  
  methods: {
     changeClick(value){
       this.currentPage=1;
      console.log('状态');
      if(this.value===1){
        this.getData(1);
      } else if(this.value ===2){
        this.getData('');
      }else{
        this.getData(this.value);
        };

    },
    modify(row, index) {
      // this.$refs.modifyinfo.open(row);
      //返回当前对象
      console.log(row, index);
    },
    sousuo() {
      console.log(1111);
       http.userWithdrawManage({
      params: {
          pages:this.currentPage,
          pageSize: 6,
          user_name:this.filterText,
        },
    })
      .then((r) => {
        console.log(r);
        this.drugList = r.data.counts;
        this.tableData = r.data.data;
      });
      // this.handleCurrentChange();
    },
    getData(status){
      http.userWithdrawManage({
      params: {
          pages:this.currentPage,
          pageSize: 6,
          user_name:this.filterText,
          state:status,
        },
    }).then((r) => {
        console.log(r);
        this.drugList = r.data.counts;
        this.tableData = r.data.data;
        // this.nowPage=1;
      });
    },
    handleCurrentChange(val) {
      this.nowPage = val;
      console.log(val);
         if(this.value===1){
        this.getData(1);
      } else if(this.value ===2){
        this.getData('');
      }else{
        this.getData(this.value);
        };

        
    },
  },
};
</script>
<style scoped>
.section1-1 {
  width: 190px;
  border-bottom: 1px solid gainsboro;
  display: flex;
  justify-content: center;
  align-items: center;
}
.input1 {
  width: 150px;
  height: 30px;
  border: none;
  margin-left: 10px;
  outline: none;
}
.paging {
  margin-top: 30px;
  margin-left: 30%;
}

.el-pagination >>> .el-pagination__jump {
  font-size: 17px;
}
.el-pagination >>> .el-icon {
  font-size: 17px;
}
.el-pagination >>> .number {
  font-size: 17px;
  width: 60px;
}
.section2{
   width: 190px;
  /* display: flex;
  justify-content: flex-end; */
  position: relative;
  left: 220px;
  top: -40px;
}
</style>